package com.seeyon.apps.kk.manager.restImpl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.seeyon.apps.kk.manager.BaseManager;
import com.seeyon.apps.kk.manager.FreemarkFlowManager;
import com.seeyon.kk.utils.MapToLowerCaseUtils;
/**
 * rest 考勤请假、加班数据 接口实现
 * @author seeyon
 *
 */
public class AttendanceDataImpl extends BaseManager{
	private static final Log log = LogFactory.getLog(AttendanceDataImpl.class);

	private FreemarkFlowManager freemarkFlowManager;

	public FreemarkFlowManager getFreemarkFlowManager() {
		return freemarkFlowManager;
	}

	public void setFreemarkFlowManager(FreemarkFlowManager freemarkFlowManager) {
		this.freemarkFlowManager = freemarkFlowManager;
	}
	
	/**
	 * 获取某个时间段的考勤数据  如:2019-10-25 00:00:00 至 2019-11-26 00:00:00 数据
	 * @return List<Map<String, Object>>
	 */
	public List<Map<String, Object>> getAnnualData(){
		String annualSql = this.freemarkFlowManager.fltTemplateIntoString("sql/attendance/SELECT_ATTENDANCE_SQL.ftl", null);
		List<Map<String, Object>> list = this.jdbcTemplate.queryForList(annualSql);
		List<Map<String, Object>> rsList = new ArrayList<Map<String,Object>>();
		for (Map<String, Object> map : list) {
			rsList.add(MapToLowerCaseUtils.mapToLower(map)); // 字段转小写
		}
		return rsList;
	}
	
}
